using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using ComponentFactory.Krypton.Toolkit;
using DukeyCssFetch.api;
using DukeyCssFetch.UI;

namespace DukeyCssFetch
{
	// Token: 0x0200002C RID: 44
	public class TagsFrm : KryptonForm
	{
		// Token: 0x0600019F RID: 415 RVA: 0x00011208 File Offset: 0x0000F408
		public TagsFrm()
		{
			
			this.InitializeComponent();
			base.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - 300, 0);
			this.method_0();
			base.TextExtra = "当前标签为: " + Comm.CurrentTag + "          ";
			this.kryptonContextMenuItem_0.Click += new EventHandler(this.kryptonContextMenuItem_0_Click);
			this.kryptonContextMenuItem_2.Click += new EventHandler(this.kryptonContextMenuItem_2_Click);
			this.kryptonContextMenuItem_3.Click += new EventHandler(this.kryptonContextMenuItem_3_Click);
		}

		// Token: 0x060001A8 RID: 424 RVA: 0x00011640 File Offset: 0x0000F840
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x060001A9 RID: 425 RVA: 0x00011660 File Offset: 0x0000F860
		private void InitializeComponent()
		{
			this.icontainer_0 = new Container();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(TagsFrm));
			this.tabs = new TabControl();
			this.tabPage1 = new TabPage();
			this.buttonSpecAny_0 = new ButtonSpecAny();
			this.kryptonContextMenuImageSelect_0 = new KryptonContextMenuImageSelect();
			this.kryptonContextMenuImageSelect_1 = new KryptonContextMenuImageSelect();
			this.kryptonContextMenuImageSelect_2 = new KryptonContextMenuImageSelect();
			this.kryptonContextMenuHeading_0 = new KryptonContextMenuHeading();
			this.buttonSpecAny_1 = new ButtonSpecAny();
			this.kryptonContextMenu_0 = new KryptonContextMenu();
			this.kryptonContextMenuItems_0 = new KryptonContextMenuItems();
			this.kryptonContextMenuItem_0 = new KryptonContextMenuItem();
			this.kryptonContextMenuItem_2 = new KryptonContextMenuItem();
			this.kryptonContextMenuItem_3 = new KryptonContextMenuItem();
			this.kryptonContextMenuItem_1 = new KryptonContextMenuItem();
			this.toolTip_0 = new ToolTip(this.icontainer_0);
			this.kryptonManager_0 = new KryptonManager(this.icontainer_0);
			this.tabs.SuspendLayout();
			base.SuspendLayout();
			this.tabs.Controls.Add(this.tabPage1);
			this.tabs.Dock = DockStyle.Fill;
			this.tabs.Location = new Point(0, 0);
			this.tabs.Name = "tabs";
			this.tabs.SelectedIndex = 0;
			this.tabs.Size = new Size(622, 177);
			this.tabs.TabIndex = 0;
			this.tabs.SelectedIndexChanged += new EventHandler(this.tabs_SelectedIndexChanged);
			this.tabPage1.Location = new Point(4, 22);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Padding = new Padding(3);
			this.tabPage1.Size = new Size(614, 151);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "tabPage1";
			this.tabPage1.UseVisualStyleBackColor = true;
			this.buttonSpecAny_0.Type = PaletteButtonSpecStyle.ArrowUp;
			this.buttonSpecAny_0.UniqueName = "7DB496E1EF18432CF6A192F381AEF935";
			this.kryptonContextMenuHeading_0.ExtraText = "";
			this.buttonSpecAny_1.KryptonContextMenu = this.kryptonContextMenu_0;
			this.buttonSpecAny_1.Type = PaletteButtonSpecStyle.Context;
			this.buttonSpecAny_1.UniqueName = "05CFAC2B2FF84CCF63A55F0C075059C3";
			this.kryptonContextMenu_0.Items.AddRange(new KryptonContextMenuItemBase[]
			{
				this.kryptonContextMenuItems_0
			});
			this.kryptonContextMenuItems_0.Items.AddRange(new KryptonContextMenuItemBase[]
			{
				this.kryptonContextMenuItem_0,
				this.kryptonContextMenuItem_2,
				this.kryptonContextMenuItem_3
			});
			this.kryptonContextMenuItem_0.Text = "选择cms";
			this.kryptonContextMenuItem_2.Text = "标签设计器";
			this.kryptonContextMenuItem_3.Text = "切换模式";
			this.kryptonContextMenuItem_1.Text = "Menu Item";
			this.toolTip_0.AutoPopDelay = 10000;
			this.toolTip_0.InitialDelay = 200;
			this.toolTip_0.ReshowDelay = 100;
			this.toolTip_0.ShowAlways = true;
			base.AutoScaleDimensions = new SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			this.AutoSize = true;
			base.ButtonSpecs.AddRange(new ButtonSpecAny[]
			{
				this.buttonSpecAny_0,
				this.buttonSpecAny_1
			});
			base.ClientSize = new Size(622, 177);
			base.Controls.Add(this.tabs);
			base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.MaximizeBox = false;
			base.Name = "TagsFrm";
			base.StartPosition = FormStartPosition.Manual;
			this.Text = "都客迷你标签";
			base.TextExtra = "";
			base.TopMost = true;
			base.FormClosing += new FormClosingEventHandler(this.TagsFrm_FormClosing);
			this.tabs.ResumeLayout(false);
			base.ResumeLayout(false);
		}

		// Token: 0x060001A2 RID: 418 RVA: 0x00011304 File Offset: 0x0000F504
		private void kryptonContextMenuItem_0_Click(object sender, EventArgs e)
		{
			TagsFrmSetting tagsFrmSetting = new TagsFrmSetting();
			if (tagsFrmSetting.ShowDialog() == DialogResult.OK)
			{
				base.TextExtra = "当前标签为: " + Comm.CurrentTag + "          ";
				this.method_0();
			}
		}

		// Token: 0x060001A1 RID: 417 RVA: 0x000112D4 File Offset: 0x0000F4D4
		private void kryptonContextMenuItem_2_Click(object sender, EventArgs e)
		{
			TagEditFrm tagEditFrm = new TagEditFrm();
			base.TopMost = false;
			if (tagEditFrm.ShowDialog() == DialogResult.OK)
			{
				this.method_0();
			}
			base.TopMost = true;
		}

		// Token: 0x060001A0 RID: 416 RVA: 0x000112B4 File Offset: 0x0000F4B4
		private void kryptonContextMenuItem_3_Click(object sender, EventArgs e)
		{
			Editor2 editor = new Editor2();
			editor.Show();
			base.Hide();
		}

		// Token: 0x060001A3 RID: 419 RVA: 0x00011340 File Offset: 0x0000F540
		private void method_0()
		{
			try
			{
				int num = 5;
				this.tabs.Controls.Clear();
				string xmlFileName = Comm.root + "\\tag\\" + Comm.CurrentTag;
				XmlNode xmlNodeByXpath = XMLHelper.GetXmlNodeByXpath(xmlFileName, "tags");
				XmlNodeList xmlNodeList = xmlNodeByXpath.SelectNodes("group");
				foreach (XmlNode xmlNode in xmlNodeList)
				{
					TabPage tabPage = new TabPage(xmlNode.Attributes["name"].InnerText);
					int num2 = 5;
					num = 5;
					int num3 = 0;
					foreach (XmlNode xmlNode2 in xmlNode.SelectNodes("tag"))
					{
						KryptonButton kryptonButton = new KryptonButton();
						kryptonButton.AutoSize = true;
						kryptonButton.AutoSizeMode = AutoSizeMode.GrowOnly;
						kryptonButton.ClientSize = new Size(Comm.tagbtnWidth, kryptonButton.ClientSize.Height);
						kryptonButton.Values.Text = xmlNode2.Attributes["name"].InnerText;
						kryptonButton.Tag = xmlNode2.SelectSingleNode("value").InnerText;
						this.toolTip_0.SetToolTip(kryptonButton, xmlNode2.SelectSingleNode("tips").InnerText);
						kryptonButton.Location = new Point(num2, num);
						kryptonButton.Click += new EventHandler(this.method_1);
						tabPage.Controls.Add(kryptonButton);
						num3++;
						if (num3 % Comm.tagcols == 0)
						{
							num += 40;
							num2 = 5;
						}
						else
						{
							num2 += 102;
						}
					}
					tabPage.Tag = new Size((Comm.tagbtnWidth + 10) * Comm.tagcols + 20, num + 60);
					this.tabs.Controls.Add(tabPage);
				}
				base.ClientSize = (Size)this.tabs.TabPages[0].Tag;
			}
			catch (Exception)
			{
				MessageBox.Show("请在模板编辑器->设置,选择你要使用的cms标签.");
			}
		}

		// Token: 0x060001A4 RID: 420 RVA: 0x000115D0 File Offset: 0x0000F7D0
		private void method_1(object sender, EventArgs e)
		{
			KryptonButton kryptonButton = sender as KryptonButton;
			Clipboard.SetText(kryptonButton.Tag.ToString());
		}

		// Token: 0x060001A5 RID: 421 RVA: 0x000115F4 File Offset: 0x0000F7F4
		private void method_2(object sender, EventArgs e)
		{
		}

		// Token: 0x060001A6 RID: 422 RVA: 0x000115F8 File Offset: 0x0000F7F8
		private void tabs_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.tabs.SelectedTab != null)
			{
				Size clientSize = (Size)this.tabs.SelectedTab.Tag;
				base.ClientSize = clientSize;
			}
		}

		// Token: 0x060001A7 RID: 423 RVA: 0x00011630 File Offset: 0x0000F830
		private void TagsFrm_FormClosing(object sender, FormClosingEventArgs e)
		{
			Comm.showtype = 0;
			Comm.SaveConfig();
		}

		// Token: 0x04000175 RID: 373
		private ButtonSpecAny buttonSpecAny_0;

		// Token: 0x0400017A RID: 378
		private ButtonSpecAny buttonSpecAny_1;

		// Token: 0x04000172 RID: 370
		private IContainer icontainer_0;

		// Token: 0x04000179 RID: 377
		private KryptonContextMenuHeading kryptonContextMenuHeading_0;

		// Token: 0x04000176 RID: 374
		private KryptonContextMenuImageSelect kryptonContextMenuImageSelect_0;

		// Token: 0x04000177 RID: 375
		private KryptonContextMenuImageSelect kryptonContextMenuImageSelect_1;

		// Token: 0x04000178 RID: 376
		private KryptonContextMenuImageSelect kryptonContextMenuImageSelect_2;

		// Token: 0x0400017C RID: 380
		private KryptonContextMenuItems kryptonContextMenuItems_0;

		// Token: 0x0400017D RID: 381
		private KryptonContextMenuItem kryptonContextMenuItem_0;

		// Token: 0x0400017E RID: 382
		private KryptonContextMenuItem kryptonContextMenuItem_1;

		// Token: 0x04000181 RID: 385
		private KryptonContextMenuItem kryptonContextMenuItem_2;

		// Token: 0x04000182 RID: 386
		private KryptonContextMenuItem kryptonContextMenuItem_3;

		// Token: 0x0400017B RID: 379
		private KryptonContextMenu kryptonContextMenu_0;

		// Token: 0x04000180 RID: 384
		private KryptonManager kryptonManager_0;

		// Token: 0x04000174 RID: 372
		private TabPage tabPage1;

		// Token: 0x04000173 RID: 371
		private TabControl tabs;

		// Token: 0x0400017F RID: 383
		private ToolTip toolTip_0;
	}
}
